﻿using Abp.Domain.Entities.Auditing;
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Camc.Quality.ProductionPlan
{
    /// <summary>
    /// 计划调度表
    /// </summary>
    public class ProductionScheduler : FullAuditedEntity<Guid>
    {
        /// <summary>
        /// 集合Id
        /// </summary>
        public Guid ParentId { get; set; }
        /// <summary>
        /// 对应节点Id
        /// </summary>
        public Guid NodeId { get; set; }

        /// <summary>
        /// 序号
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Model { get; set; }
        /// <summary>
        /// 发次
        /// </summary>
        public string LotNo { get; set; }
        /// <summary>
        /// 型号Id
        /// </summary>
        public Guid? ModelId { get; set; }
        /// <summary>
        /// 发次Id
        /// </summary>
        public Guid? LotNoId { get; set; }
        /// <summary>
        /// 图号
        /// </summary>
        public string DrawingNo { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string ProductionName { get; set; }
        /// <summary>
        /// 标准工时
        /// </summary>
        public decimal WorkingHour { get; set; }
        [CanBeNull]
        /// <summary>
        /// 绩效工时
        /// </summary>
        public decimal PerformanceHour { get; set; }

        /// <summary>
        /// 配套状况
        /// </summary>
        public string MatchingCondition { get; set; }
        [CanBeNull]
        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }
        [CanBeNull]
        /// <summary>
        /// 计划完成时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 计划状态
        /// </summary>
        public ProductingStatus ProductingStatus { get; set; }
        /// <summary>
        /// 报工状态
        /// </summary>
        public ProductedStatus ProductedStatus { get; set; }

        /// <summary>
        /// 装配班组
        /// </summary>
        public string OrganizationUnitId { get; set; }
        /// <summary>
        /// 装配班组描述
        /// </summary>
        public string OrganizationUnitDesc { get; set; }

        /// <summary>
        ///装配人员
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 装配人员描述
        /// </summary>
        public string UserName { get; set; }
        [CanBeNull]
        /// <summary>
        /// 调度员Id
        /// </summary>
        public long DispatcherId { get; set; }


        /// <summary>
        /// 调度员描述
        /// </summary>
        public string DispatcherName { get; set; }
        [CanBeNull]
        /// <summary>
        /// 排配时间
        /// </summary>
        public DateTime ArrangementTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string AssignmentAuthor { get; set; }
        /// <summary>
        /// 编制时间
        /// </summary>
        public string AssignmentTime { get; set; }
        /// <summary>
        /// 变化标识（变红）
        /// </summary>
        public string Color { get; set; }

        #region 工序工步扩展
        /// <summary>
        /// 任务编号
        /// </summary>
        public string JobNumber { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string TechniqueName { get; set; }
        /// <summary>
        /// 工艺编号
        /// </summary>
        public string TechniqueNumber { get; set; }

        /// <summary>
        /// 工步图号
        /// </summary>
        public string WorkStepDrawingNo { get; set; }

        /// <summary>
        /// 工步名称
        /// </summary>
        public string WorkStepName { get; set; }
        /// <summary>
        /// 装配开始时间
        /// </summary>
        [CanBeNull]
        public DateTime? AssemblyStartTime { get; set; }
        /// <summary>
        /// 装配结束时间
        /// </summary>
        [CanBeNull]
        public DateTime? AssemblyEndTime { get; set; }
        /// <summary>
        /// 工序Id
        /// </summary>
        [CanBeNull]
        public Guid? ProcessesEntityId { get; set; }
        /// <summary>
        /// 是否级联
        /// </summary>
        public bool IsCascade { get; set; } = false;
        /// <summary>
        /// 下发时间
        /// </summary>
        [CanBeNull]
        public DateTime? IssueTime { get; set; }


        #endregion
        /// <summary>
        /// 是否下发
        /// </summary>
        public bool Issue { get; set; }

    }
}
